<template>
  <div id="app">
    <div id="nav">
      <router-link to="/home">{{msg}}</router-link> |
      <router-link to="/about">About</router-link>|
      <!--  路由传参 -->
      <!-- <router-link to="/cart/888">购物车</router-link> -->
      <!--   路由组件跳转的写法2 -->
      <!-- <router-link :to="{name:'cart',params:{pid:888}}">购物车</router-link> -->
      <router-link :to="{name:'cart'}">购物车</router-link>|
      <router-link to="/my">个人中心</router-link>
    </div>
    <router-view />
  </div>
</template>
<script>
export default {
  name: "app",
  data () {
    return {
      msg: "首页"
    }
  }
}
</script>
<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  a {
    color: blue;
    // router-link-exact-active 严格的匹配当前激活的class
    //  router-link-active  当前激活的router-link 组件自带的class
    &.router-link-exact-active {
      color: red;
    }
  }
}
</style>
